"""
File: log_utils.py
Author: ershixiong
Date: 2023/12/25
describe:

"""
import logging
import os

from hogwarts.Wework.utils.utils import get_root_dir, get_timestamp

logger = logging.getLogger('wework test')
logger.setLevel(logging.DEBUG)

ch = logging.StreamHandler()
ch.setLevel(logging.DEBUG)

filename = os.sep.join([get_root_dir(), f'log_result/log_{get_timestamp()}.log'])
file_handle = logging.FileHandler(filename=filename)
file_handle.setLevel(logging.DEBUG)

formatter = logging.Formatter('%(asctime)s %(name)s :%(levelname)s :lineno:%(lineno)d :\n%(message)s ')

ch.setFormatter(formatter)
file_handle.setFormatter(formatter)

logger.addHandler(ch)
logger.addHandler(file_handle)
